import { request } from '@umijs/max';

/** 分页查询厂商 GET /terminal/brand/list */
export async function getBrandListByPage(params: API.QueryBrandPageParams) {
  return request<API.QueryPageResp<API.Brand>>('/terminal/brand/list', {
    method: 'GET',
    params,
  });
}

/** 新增厂商 POST /terminal/brand/add */
export async function addBrand(params: API.Brand) {
  return request<API.Resp>('/terminal/brand/add', {
    method: 'POST',
    data: params,
  });
}

/** 更新厂商 POST /terminal/brand/update */
export async function updateBrand(params: API.Brand) {
  return request<API.Resp>('/terminal/brand/update', {
    method: 'POST',
    data: params,
  });
}

/** 通过ID查询单条厂商 GET /terminal/brand/get/{id} */
export async function getBrandById(id: React.Key) {
  return request<API.Resp<API.Brand>>(`/terminal/brand/get/${id}`, {
    method: 'GET',
  });
}

/** 通过ID删除单条厂商 POST /terminal/brand/delete */
export async function deleteBrandById(id: React.Key) {
  return request<API.Resp>(`/terminal/brand/delete`, {
    method: 'POST',
    params: {
      id,
    },
  });
}

/** 查询厂商下拉框列表 GET /terminal/brand/select */
export async function getBrandSelect() {
  return request<API.Resp<API.BrandSelect[]>>(`/terminal/brand/select`, {
    method: 'GET',
  });
}
